#define  _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#include <string.h>
void swap(char* pa, int len)
{
	char* left = pa - len + 1;
	char* right = pa;
	int i = 0;
	
	while (left < right)
	{
		char tmp = *left;
		*left = *right;
		*right = tmp;
		left++;
		right--;
	}

}
int main()
{
	char arr[10001] = { 0 };
	gets(arr);
	int len = strlen(arr);
	int i = 0;
	for (i = 0; i < len; i++)
	{
		if (arr[i] < 'A' || (arr[i] > 'Z' && arr[i] < 'a') || arr[i]>'z')
			arr[i] = ' ';
	}
	swap(arr + len - 1 , len);
	int count = 0;
	for (i = 0; i <= len; i++)
	{
		
		if (arr[i] == ' ' || arr[i] == '\0')
		{
			swap(&arr[i] - 1, count);
			count = 0;
		}
		else
			count++;
	}


	puts(arr);

	return 0;
}